package shop.up.all.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import shop.up.common.result.Result;
import shop.up.product.client.ProductFeignClient;

import javax.servlet.http.HttpServletRequest;

/**
 * 商城首页 {@link IndexController}
 *
 * @author Kevin
 * @date 2022/7/18
 */
@Controller
public class IndexController {

    @Autowired
    private ProductFeignClient productFeignClient;

    @GetMapping({"/", "index.html"})
    public String index(HttpServletRequest request){
        // 获取首页分类数据
        Result result = productFeignClient.getBaseCategoryList();
        request.setAttribute("list",result.getData());
        return "index/index";
    }
}
